/*
ID: wxm071
PROG: herdle
LANG: C++17
*/
#include <string>
#include <vector>
#include <fstream>
#include <iostream>

using namespace std;

//#define _USACO_

int main(int argc, char const *argv[])
{
    istream *lpofs;

    ifstream ifs("herdle.in");

#ifdef _USACO_
    lpofs = &cin;
#else
    lpofs = &ifs;
#endif

    string str1, str2, str3;

    *lpofs >> str1;
    *lpofs >> str2;
    *lpofs >> str3;
    string correct = str1 + str2 + str3;

    string str4, str5, str6;
    *lpofs >> str4;
    *lpofs >> str5;
    *lpofs >> str6;
    string suppose = str4 + str5 + str6;

    int green = 0, yellow = 0;

    for (int i = 0; i < suppose.size(); ++i)
    {
        if (correct[i] == suppose[i])
        {
            ++green;
            correct[i] = '0';
            suppose[i] = '1';
        }
    }

    for (int i = 0; i < suppose.size(); ++i)
    {
        if (suppose[i] == '1')
        {
            continue;
        }
        int pos = correct.find(suppose[i]);
        if (pos != correct.npos)
        {
            ++yellow;
            correct[pos] = '2';
            suppose[i] = '3';
        }
    }

    ofstream ofs("herdle.out");
    ofs << green << endl;
    ofs << yellow << endl;
    
    cout << green << endl;
    cout << yellow << endl;
    
    return 0;
}
